﻿using System;
using System.Data;
using System.Data.SqlClient;
using System.Text;

namespace DAL
{
    public  class QuestionStatusDAL
    {
          /// <summary>
        /// 记录测试人员维度得分。
        /// </summary>
        public static int RecordScore(string tester_sn, int question_id, string question_selected, int question_is_dirty, DateTime question_start_dt, DateTime question_end_dt)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("SELECT * FROM dbo.tb_Tester_Question_Status WHERE tester_sn='" + tester_sn + "' and question_id=" + question_id );
            if (DbHelperSQL.ExecuteSql(strSql.ToString()) >= 1)
            {
                return -1;
            }
            strSql.Clear();
            strSql.Append("insert into ExamDB.dbo.tb_Tester_Question_Status(");
            strSql.Append(@"tester_sn,
                            question_id,
                            question_tester_selected,
                            question_is_dirty,
                            question_start_dt,
                            question_end_dt)");

            strSql.Append(" values (");

            strSql.Append("'").Append(tester_sn).Append("'").Append(",");
            strSql.Append(question_id).Append(",");
            strSql.Append("'").Append(question_selected).Append("'").Append(",");
            strSql.Append(question_is_dirty).Append(",");
            strSql.Append("'").Append(question_start_dt).Append("'").Append(",");
            strSql.Append("'").Append(question_end_dt).Append("'").Append(")");

            return DbHelperSQL.ExecuteSql(strSql.ToString());
        }
    }
}
